﻿using Cms.Domain.RepositoryInterfaces;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;

namespace Cms.Tests.Unit.Application
{
    [TestClass]
    public class BasePresenterTests
    {
        protected Mock<IRepositoryFactory> FactoryMock;
        protected Mock<ISiteRepository> SiteRepositoryMock;
        protected Mock<ILocaleRepository> LocaleRepositoryMock;
        protected Mock<IPageRepository> PageRepositoryMock;
        protected Mock<IFolderRepository> FolderRepositoryMock;
        protected Mock<IAdministratorRepository> AdministratorRepositoryMock;
        protected Mock<IContentRepository> ContentRepositoryMock;
        protected Mock<IMediaRepository> MediaRepositoryMock;
        protected Mock<ISystemRepository> SystemRepositoryMock;
        protected Mock<IUserRepository> UserRepositoryMock;
        protected Mock<IPermissionRepository> PermissionRepositoryMock;

        protected void InitRepositoryFactoryMock()
        {
            FactoryMock = new Mock<IRepositoryFactory>();
            SiteRepositoryMock = new Mock<ISiteRepository>();
            LocaleRepositoryMock = new Mock<ILocaleRepository>();
            PageRepositoryMock = new Mock<IPageRepository>();
            FolderRepositoryMock = new Mock<IFolderRepository>();
            AdministratorRepositoryMock = new Mock<IAdministratorRepository>();
            ContentRepositoryMock = new Mock<IContentRepository>();
            MediaRepositoryMock = new Mock<IMediaRepository>();
            SystemRepositoryMock = new Mock<ISystemRepository>();
            UserRepositoryMock = new Mock<IUserRepository>();
            PermissionRepositoryMock = new Mock<IPermissionRepository>();
            FactoryMock.Setup(f => f.SiteRepository).Returns(SiteRepositoryMock.Object);
            FactoryMock.Setup(f => f.LocaleRepository).Returns(LocaleRepositoryMock.Object);
            FactoryMock.Setup(f => f.PageRepository).Returns(PageRepositoryMock.Object);
            FactoryMock.Setup(f => f.FolderRepository).Returns(FolderRepositoryMock.Object);
            FactoryMock.Setup(f => f.AdministratorRepository).Returns(AdministratorRepositoryMock.Object);
            FactoryMock.Setup(f => f.ContentRepository).Returns(ContentRepositoryMock.Object);
            FactoryMock.Setup(f => f.MediaRepository).Returns(MediaRepositoryMock.Object);
            FactoryMock.Setup(f => f.SystemRepository).Returns(SystemRepositoryMock.Object);
            FactoryMock.Setup(f => f.UserRepository).Returns(UserRepositoryMock.Object);
            FactoryMock.Setup(f => f.PermissionRepository).Returns(PermissionRepositoryMock.Object);
        }
    }
}
